package com.example.erp.config.error;

import com.example.erp.utils.ErrorEnum;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class CustomException extends RuntimeException {

    private String code;
    private String message;
    private ErrorEnum errorEnum;

    /**
     * 自定义异常枚举构造
     *
     * @param superEnumFace
     */
    public CustomException(ErrorEnum superEnumFace) {
        this.code = superEnumFace.getErrorCode();
        this.message = superEnumFace.getErrorMsg();
        this.errorEnum=superEnumFace;
    }


    public CustomException(String msg) {
        this.code = "500";
        this.message = msg;
    }

}
